import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/views/Index.vue'
import Home from '@/views/MenuDemo.vue'
import GoodsContent from '@/views/GoodsContent.vue'
import Phones from '@/views/Phones.vue'
import Tablets from '@/views/Tablets.vue'
import Laptops from '@/views/Laptops.vue'
import Wearables from '@/views/Wearables.vue'
import Cart from '@/views/Cart.vue'

const routes = [
    {
        path: '/',
        component: Index,
        children: [
            {
                path: '',
                name: 'Home',
                component: Home
            },
            {
                path: 'goods/:id',
                name: 'GoodsContent',
                component: GoodsContent
            },
            {
                path: 'phones',
                name: 'Phones',
                component: Phones
            },
            {
                path: 'tablets',
                name: 'Tablets',
                component: Tablets
            },
            {
                path: 'laptops',
                name: 'Laptops',
                component: Laptops
            },
            {
                path: 'wearables',
                name: 'Wearables',
                component: Wearables
            },
            {
                path: 'cart',
                name: 'Cart',
                component: Cart
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router